{% extends "main/base.html" %}
{% load static i18n %}
{% block title %}{% trans '创建设备列表' %}{% endblock %}
{% block this_css %}
<link rel="stylesheet" type="text/css" href="{% static 'flatlab/css/bootstrap-select.min.css' %}">
{% endblock %}
{% block content %}
<div class="col-lg-offset-2 col-lg-8">
    <section class="panel">
        <header class="panel-heading">
            {% trans "创建设备列表" %}
            {% if form.errors %}
            <p>{% trans "提交的数据有误,请认真检查!" %}</p>
            {% endif %}
        </header>
        <div class="panel-body">
            <form method="post" action="{{ request.path }}?next={{ request.GET.next }}" class="form-horizontal">{% csrf_token %}
                {{ form.non_field_errors }}
                <div class="form-group">
                    <div class="col-sm-2"><label for="id_title">{% trans '名称' %}</label></div>
                    <div class="col-sm-10"><input type="text" name="title" class="form-control" maxlength="100" required id="id_title" />{{ form.title.errors }}</div>
                </div>
                <div class="form-group">
                    <div class="col-sm-2"><label for="id_order_list">{% trans '请选择' %}</label></div>
                    <div class="col-sm-10">
                        <select name="order_list" class="selectpicker show-tick form-control" data-live-search="true" required id="id_order_list">
                            <option value="" selected>---------</option>
                            {% for e in order_list %}
                            <option value="{{ e.pk }}">[{{ e.pk }}] {{ e.order_desc }}</option>
                            {% endfor %}
                        </select>
                        {{ form.order_list.errors }}
                    </div>
                </div>
                <div class="form-group" align="right">
                    <div class="col-sm-12">
                        <a href="{% url 'main:batch_equipment_list' %}"><button type="button" class="btn btn btn-primary">{% trans "返回" %}</button></a>
                        <button type="submit" class="btn btn-danger">{% trans "添加" %}</button>
                    </div>
                </div>
            </form>
        </div>
    </section>
</div>
{% endblock %}
{% block this_js %}
<script type="text/javascript" src="{% static 'flatlab/js/bootstrap-select.min.js' %}"></script>
{% endblock %}